package group2.service.impl;

import group2.mapper.UserMapper;
import group2.model.UserInfo;
import group2.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;

import java.util.List;

/**
 * @author 周祖航
 * @date 2020/8/18 001823:12
 **/
@Service("userService")
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;
    //用户
    //登陆
    @Override
    public UserInfo login(UserInfo user) {
       return userMapper.userLogin(user);
    }
    //注册
    @Override
    public UserInfo register(UserInfo user){return userMapper.register(user);}
    //按名字查找是否存在
    @Override
    public boolean selectByname(UserInfo user){
        boolean load=false;//flase为不存在该用户
        UserInfo userInfo=userMapper.selectByname(user);
        if (userInfo!=null){
           load=true; //ture为已存在该用户
        }
        return load;
    }

}
